local arts = {
    [[图标\ZB_1_13.blp]],
    [[图标\ZB_1_13_1.blp]],
    [[图标\ZB_1_13_2.blp]],
    [[图标\ZB_1_13_3.blp]],
    [[图标\ZB_1_13_4.blp]],
    [[图标\ZB_1_13_5.blp]],
    [[图标\ZB_1_13_6.blp]],
}
ac.item('噬魂之心'){
    model = [[ktswp_bs.mdl]],
    once_flag = true,
    ['可吞噬'] = true,
}
ac.buff('噬魂之心'){
    update_info = function(self)
        local color,color_text = item_color(self.item.item_level)
        local art = arts[self.item.item_level]
        self.item.title = color_text:format(self.name)
        self.item:set_art(art)
        self.item:set_color(color)
    end,
    on_add = function(self)
		local unit = self.owner
        self.sxad = 0
        self:update_info()
        self:gc(unit:event '英雄-击杀单位'(function(trg)
            if self.item.item_level<6 then
                self.item:add_count(1)
                if self.item:get_count()>=1000 then
                    self.item.item_level = (self.item.item_level or 0) + 1
                    self:update_info()
                    self.item:set_count(0)
                    self.item:discard()
                    unit:add_effect([[Abilities\Spells\Items\AIem\AIemTarget.mdl]], 'origin'):remove()
                    jass.UnitAddItem(unit.handle, self.item.handle)
                    if self.item.item_level==6 then
                        unit:notify('单位-吞噬物品', unit, self.item)
                    end
                end
            end
        end))
        self:gc(ac.loop(1000,function()
            local sxad = self.item.item_level * 2
            unit:add('力量加成',sxad - self.sxad)
            unit:add('敏捷加成',sxad - self.sxad)
            unit:add('智力加成',sxad - self.sxad)
            self.sxad = sxad
        end))
        if self.item.item_level==6 then
            unit:notify('单位-吞噬物品', unit, self.item)
        end
    end,
    on_remove = function(self)
		local unit = self.owner
        unit:add('力量加成',- self.sxad)
        unit:add('敏捷加成',- self.sxad)
        unit:add('智力加成',- self.sxad)
    end,
}